//创建二叉数函数
			var twoXS=function(){
				//初始化二叉数节点
				var InitNodes=function(key){
					this.key=key;
					this.left=null;
					this.right=null;
				};
				//创建二叉数根节点
				var rool=null;
				//对外接口，并给根节点赋值
				this.nodeAssign=function(key){
					var nodeObject=new InitNodes(key);
					if(rool) nodeAssignMent(rool,nodeObject);
					else rool=nodeObject;
				};
				//为节点赋值
				var nodeAssignMent=function(node,nodeObject){
					if(node.key>nodeObject.key){
						if(node.left) nodeAssignMent(node.left,nodeObject);
						else  node.left=nodeObject;
					}
					else{
						if(node.right) nodeAssignMent(node.right,nodeObject);
						else  node.right=nodeObject;
					}
				};
				
				//对外接口，查询所有节点
				this.selectNodes=function(callback){
					
//					selectNodeTop(rool,callback);
					selectNode(rool,callback);
//					selectNodeBot(rool,callback);
				}
				//中序排列
				var selectNode=function(node,callback){
					if(node){
						selectNode(node.left,callback);
						callback(node.key);
						selectNode(node.right,callback);
					}
				}
				
				//其他排序
				//底序排列
				var selectNodeBot=function(node,callback){
					if(node){
						selectNodeBot(node.left,callback);
						selectNodeBot(node.right,callback);
						callback(node.key);
					}
				}
				//头序排列
				var selectNodeTop=function(node,callback){
					if(node){
						callback(node.key);
						selectNodeTop(node.left,callback);
						selectNodeTop(node.right,callback);
					}
				};
				
				//获得最大值
				this.maxValue=function(callback){
					maxValueNode(rool,callback);
				}
				var maxValueNode=function(node,callback){
					if(node){
						while(node&&node.right!==null){
							node=node.right;
						}
						callback("max:"+node.key);
						return node.key;
					}
					return null;
				}
				
				//获得最小值
				this.minValue=function(callback){
					minValueNode(rool,callback);
				}
				var minValueNode=function(node,callback){
					if(node){
						while(node&&node.left!==null){
							node=node.left;
						}
						callback("min:"+node.key);
						return node;
					}
				return null;		
				}
				
				//按条件查找节点是否存在
				this.ifSelectNodes=function(key){
				 rool=ifSelectNode(rool,key);
				 selectNode(rool,callback);
				 console.info(rool)
				}
				var ifSelectNode=function (node,key){
					if(node){
						if(node.key>key){
							node.left=ifSelectNode(node.left,key);
							return node;
						}
						if(node.key<key){
							node.right=ifSelectNode(node.right,key);
							return node;
						}
						if(node.key==key)
						{
							console.log("找到了"+node.key+"....准备删除中");
							if(node.right&&node.left)
							{
								var returnNode=minValueNode(node.right,callback);
								
								node.key=returnNode.key;
								node.right=ifSelectNode(node.right,returnNode.key)

							}else if(node.right||node.left){
								if(node.right)
								{
								node=node.right;
								}
								else
								{
								node=node.left;
								}
							}
							else{
								node=null;
							}
							return node;
							
						}
					}
					else{
						console.log("没有找到");
						return null;
					}
				}
				
				//删除节点
				this.removeNodes=function(key){
					removeNode(rool,key);
				}
				var removeNode=function(rool,key){
					
				}
			}
			var currentObject=new twoXS();
			var list=[6,3,9,7,1,4,8,5];
			list.forEach(function(key){
				currentObject.nodeAssign(key);
			});
			//排序
			currentObject.selectNodes(callback);
			//获得最大值
			currentObject.maxValue(callback);
			//获得最小值
			currentObject.minValue(callback);
			//按条件查找值
			currentObject.ifSelectNodes(3);
			function callback(value){
				console.log(value);
			}